Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ChewingTextService.cpp for output define string(ctrl1~ctrl9) #109

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

AIdrifter
Copy link

Now we can save our string to dictionary.txt(C:/Users/usernmae/dictionary.txt) line 1~line 9 (line 0 can't be uesd)and output our string on uncomposition mode.

We will read string from dictoinary.txt when pressing first button.
Add changed buffer to dictoinary.txt on composition-mode and
reload ctrl buffer after pressing button next time.

However, we find another problem that '`' will be triggered when press ctrl+1 or ctrl+0 on composition mode.
I don't know how to fix because this behavior has existed before previous version.

Now we can save our string to dictionary.txt(C:/Users/usernmae/dictionary.txt) line 1~line 9 (line 0 can't be uesd)and output our string on uncomposition mode.

We will read string from dictoinary.txt  when pressing  first button.
Add changed buffer to dictoinary.txt on composition-mode and
reload ctrl buffer after pressing button next time.

However, we find another problem that '`' will be triggered when press ctrl+1 or ctrl+0 on composition mode.
I don't know how to fix because this behavior has existed before previous version.
@czchen
Copy link
Member

czchen commented Jul 12, 2014

@AIdrifter Please take a look at review result, thanks.

AIdrifter and others added 3 commits July 18, 2014 15:31
…e.cpp)

這邊我想想說切乾淨一點
把需要自訂字串的部分獨立成一個class出來

主要功能解說如下
平常利用
examineCtrlFalg判斷ctrl+num到底有沒有被觸發

if 被觸發了
   if 在非組字模式
        就把txt內預存的字串丟出
        (當然一開始就先把所有txt檔都讀到buf內了

    else 非組字模式
        就把buf換成我們新加入的字串
else
   不做任何事

目前修正版本
   1.已經不會有之前觸發到ctrl+` 的問題(why? 包成class 會有差?

   2.有照RAII的模式 在function內把檔案的讀寫完成
     並用mutex做控制
     不過我現在的版本是在 object defString死掉以後
     才把ctrl buf一次寫到txt內

     感覺這樣會發生一個問題
     因為其實不同process load的dll是不一樣的
     1.開啟IE   在IE中加入字定字串ctrl+2 切大西瓜
     2.開啟notepad  notepad的ctrlbuf 是從txt檔內在讀一次
       所以沒有被還是舊的

     感覺這樣好像不太好
     用以前更換buf
     就寫進去txt內的方法好像比較不用擔心這個問題
     是不是要再改回去?

   3.用register可以解決這問題?
     不知道會不會3~4個dll共用同一組register
     但是calss的寫法 好像沒辦法在member中宣告register

   4.現在  是一行一行讀  一行一行寫入
     但是使用者在讀檔的時候
     如果檔案內沒有10行字串 對應的位置是會錯誤的
     這邊我暫時想不到解決方法

     還有哪些方法讓使用者可以在txt檔為空的時候
     只加入ctrl+ 5  "切大西瓜"
     就印出 "切大西瓜" 而其他ctrl卻都指印岀空字串?
     感覺不在一開始的txt 就先寫好10組字串
     這些事都沒有辦法完成
     (印像中PCMan  說這邊需要用nsi
      包安裝檔 不知道我有沒有記錯

目前這版本就是這些問題
會朝class 的memory laout 與life cycle
這方面的地方找資料 因為這關聯到兩邊印出字串有沒有同步的問題
There are some problem before this version.
1.Function getline(buf) via using buf has been not cleared.
  Buf will get gibberish while translating to UTF16.

  This problem is modified now.

2.Write string to defUser.txt immediately instead of writting string after closed Chewing.dll,
  which mean openning both A.notepad and B.notepad and then A.notepad add new string to defuser.txt.
  B.notepad can update buffer immediately
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants